﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Person_ChangePassWord : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (!Membership.ValidateUser(HttpContext.Current.User.Identity.Name, OriginalPassword.Text))
        {
            WFWebLib.WFGlobal.ShowAlart(this,"OriginalPassword is incorrect!");
            return;
        }
        MembershipUser user = Membership.GetUser(HttpContext.Current.User.Identity.Name);
        if (user.ChangePassword(OriginalPassword.Text, Password.Text))
        {
            //WFWebLib.WFGlobal.ShowAlart(this, "Password changing success!");
            //Response.Redirect("~/Index.aspx");
            WFWebLib.WFGlobal.ShowAlertAndRedirect(this, "Password changing success!", "Index.aspx");
        }
    }
}